<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/24
 * Time: 8:59
 */

namespace app\ext\model;

use think\Model;

class TodoModel extends Model
{
    public function add($data)
    {
        if(empty($data)) return false;
        return db('todo')->insert($data);
    }

    public function todoList($page = 1, $limit = 10)
    {
        $page_start = ($page - 1) * $limit;
        $list = db('todo')->where(['is_delete'=>0])->order('id desc')->limit($page_start,$limit)->select();
        return $list;
    }

    public function del($id = 0)
    {
        return db('todo')->where(['id'=>$id])->delete();
    }
}